package com.njwb.day08;

public class TestStringBuffer {
    public static void main(String[] args) {
        StringBuffer sb=new StringBuffer();
        System.out.println(sb);//""
        sb=new StringBuffer("hello");
        System.out.println(sb);//hello
        sb.append("abc");
        System.out.println(sb);//helloabc
        sb.append(10);
        System.out.println(sb);//helloabc10
        sb.append("aaa").append("bbb").append("ccc");
        System.out.println(sb);////helloabc10aaabbbccc
        System.out.println();
        fn1();

    }

    public static void fn1(){
        String str="abc";
        StringBuffer sb=new StringBuffer(str);
        long start=System.currentTimeMillis();
        /*for (int i=0;i<250000;i++){
            str+="abc";
        }*/
        for (int i=0;i<350000;i++){
            sb.append("abc");
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);
        //System.out.println(str);
    }



}
